//
//  SIHelpDetailViewController.m
//  CampingLight
//
//  Created by Piccolo on 2018/6/30.
//  Copyright © 2018 SmartIT. All rights reserved.
//

#import "SIHelpDetailViewController.h"

@interface SIHelpDetailViewController () {
    
    
    __weak IBOutlet UILabel *_questionLabel;
    __weak IBOutlet UILabel *_answerLabel;
    __weak IBOutlet UIImageView *_QRCodeImageView;
}

@end

@implementation SIHelpDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupNavigationBar];
    [self setupLabels];
    [self setupLabelText];
    [self setupQRCodeImageView];
}

- (void)setupLabels {
    
    [_questionLabel si_setMultipleLine];
    [_answerLabel si_setMultipleLine];
}

- (void)setupLabelText {
    
    _questionLabel.text = _questionString;
    [_questionLabel sizeToFit];
    _answerLabel.text = _answerString;
    [_answerLabel sizeToFit];
    [SIUtil setDownView:_answerLabel aboveView:_questionLabel spacing:8.f];
}

- (void)setupQRCodeImageView {
    
    //_QRCodeImageView.hidden = !_showQRCode;
    _QRCodeImageView.hidden = YES;
    if (_showQRCode) {
        [_QRCodeImageView si_setOriginY:(SCREEN_HEIGHT + CGRectGetMaxY(_answerLabel.frame) - CGRectGetHeight(_QRCodeImageView.frame)) / 2];
    }
}

- (void)setupNavigationBar {
    
    self.navigationItem.title = [SIUtil getSingleKeyStr:@"TEXT_HELP"];
    UIBarButtonItem *backItem = [SIUtil newBarItemWithImageName:@"ico-back.png" target:self action:@selector(backBtnOnClick:)];
    self.navigationItem.leftBarButtonItem = backItem;
}

#pragma mark - Button Action

- (void)backBtnOnClick:(UIButton *)btn {
    
    [self.navigationController popViewControllerAnimated:YES];
}

@end
